package com.xiao.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.xiao.service.ResponseMessageService;
import com.xiao.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MessageController {


    @Autowired
    private ResponseMessageService responseMessageService;
    private ObjectMapper objectMapper = new ObjectMapper();

//    页面请求用户接收到的全部消息
    @RequestMapping("/")
    public Object AllMessage(long uid) throws JsonProcessingException {
        return objectMapper.writeValueAsString(responseMessageService.queryAllMessage(uid));
    }
//     页面请求用户接收到的通知
    @RequestMapping("/")
    public Object NotMessage(long uid) throws JsonProcessingException {
        return objectMapper.writeValueAsString(responseMessageService.queryNotMessage(uid));
    }
//     页面请求用户接收到的打卡
    @RequestMapping("/")
    public Object CloMessage(long uid) throws JsonProcessingException {
        return objectMapper.writeValueAsString(responseMessageService.queryCloMessage(uid));
    }
//     页面请求用户接收到的讨论
    @RequestMapping("/")
    public Object DisMessage(long uid) throws JsonProcessingException {
        return objectMapper.writeValueAsString(responseMessageService.queryDisMessage(uid));
    }
//     页面请求用户接收到的讨论
    @RequestMapping("/")
    public Object ExmMessage(long uid) throws JsonProcessingException {
        return objectMapper.writeValueAsString(responseMessageService.queryExmMessage(uid));
    }


}
